﻿app.controller('StoreListCtrl', ['$scope', '$http', '$filter','httpPlus', function ($scope, $http, $filter,httpPlus) {
    $scope.areas = _.map(_.range(1, 4), function (i) {
        return {
            name: "区域" + i,
            value: i
        }
    });
    $scope.brands = _.map(_.range(1,5), function (i) {
        return {
            name: "品牌" + i,
            value: i
        }
    });
    $scope.aaa = function (item) {
        console.log(item);
    }
    $scope.showAreas = false;
    $scope.showBrands = false;
    $scope.showAreas_click = function () {
        $scope.showBrands = false;
        $scope.showAreas = !$scope.showAreas;
    }
    $scope.showBrands_click = function () {
        $scope.showAreas = false;
        $scope.showBrands = !$scope.showBrands;
    }
    //取消遮罩
    $scope.cancelMask_click = function () {
        $scope.showAreas = false;
        $scope.showBrands = false;
    }
    //监视 
    $scope.$watch('currArea', function (val) {
        if (val) {
            $scope.showAreas = false;
        }
    })
    $scope.$watch('currBrand', function (val) {
        if (val) {
            $scope.showBrands = false;
        }
    })
    //取消选择
    $scope.cancelSelectArea_click = function () {
        $scope.currArea = undefined;
        $scope.showAreas = false;
    }
    $scope.cancelSelectBrand_click = function () {
        $scope.currBrand = undefined;
        $scope.showBrands = false;

    }
    httpPlus
        .RRRApi('stores/list')
        .then(function (data) {
            console.log(data);
            $scope.storeList = data;
        });
}]);